# -*- coding: utf-8 -*-
# @Time    : 2024/11/7  15:09
# @Author  : Nabby
# @FileName: resource_impl.py
# @Desc    :

from app import db
from infrastructure.po.mode.resource import Resource

class ResourceImpl(object):
    @classmethod
    def get_resource_list(cls):
        # resource_list = db.session.query(Resource).filter(Resource.sys_resource_type_id == 1).all()
        resource_list = db.session.query(Resource).all()
        return resource_list

    @classmethod
    def get_resource_by_id(cls, resource_id):
        resource = db.session.query(Resource).filter(Resource.id == resource_id).first()
        return resource

    @classmethod
    def get_resource_by_name(cls, name):
        resource = db.session.query(Resource).filter(Resource.name == name).first()

